/**
 * Created by Heimerdinger on 2017/9/8.
 * 换肤功能
 * 吴虹
 */
window.onload = function () {

     function SetCookie(name, value) {
        var argv = SetCookie.arguments;
        var argc = SetCookie.arguments.length;
        var expires = (2 < argc) ? argv[2] : null;
        var path = (3 < argc) ? argv[3] : null;
        var domain = (4 < argc) ? argv[4] : null;
        var secure = (5 < argc) ? argv[5] : false;
        document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");
    }

    function GetCookie(Name) {
        var search = Name + "=";
        var returnvalue = "";
        if (document.cookie.length > 0) {
            offset = document.cookie.indexOf(search);
            if (offset != -1) {
                offset += search.length;
                end = document.cookie.indexOf(";", offset);
                if (end == -1)
                    end = document.cookie.length;
                returnvalue = unescape(document.cookie.substring(offset, end));
            }
        }
        return returnvalue;
    }

    var thisskin;
    thisskin = GetCookie("nowskin");
    if (thisskin != "")
        skin.href = thisskin;
    else
        skin.href = "css.css";
    function changecss(url) {
            
        if (url != "") {
            skin.href = url;
            var expdate = new Date();
            expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 30));
            //expdate=null;
            //以下设置COOKIES时间为1年,自己随便设置该时间..
            SetCookie("nowskin", url, expdate, "/", null, false);
        }
    }


    // $.session.set('default'," ");
    // $.session.set('lightBlue',"pf-lightBlue");
    // $.session.set('darkBlue',"pf-darkBlue");
    // $.session.set('darkGreen',"pf-darkGreen");
    //
    // $(".default").click(function (){
    //     $("#link1").href="../resources/css/skin111.css";
    //     $(window.frames["bottom"].document).find("body").removeClass("pf-darkBlue");
    //     $(window.frames["bottom"].document).find("body").removeClass("pf-darkGreen");
    //     $(window.frames["bottom"].document).find("body").removeClass("pf-lightBlue");
    // });
    //
    // $(".lightBlue").click(function () {
    //     $(window.frames["bottom"].document).find("#link1").href="../resources/css/skin.css";
    //     $(window.frames["bottom"].document).find("body").removeClass("pf-darkBlue");
    //     $(window.frames["bottom"].document).find("body").removeClass("pf-darkGreen");
    //     $(window.frames["bottom"].document).find("body").addClass("pf-lightBlue");
    // });
    //
    // $(".darkBlue").click(function () {
    //     $(window.frames["bottom"].document).find("body").removeClass("pf-lightBlue");
    //     $(window.frames["bottom"].document).find("body").removeClass("pf-darkGreen");
    //     $(window.frames["bottom"].document).find("body").addClass("pf-darkBlue");
    // });
    //
    // $(".darkGreen").click(function () {
    //     $(window.frames["bottom"].document).find("body").removeClass($.session.get('lightBlue'));
    //     $(window.frames["bottom"].document).find("body").removeClass($.session.get('darkBlue'));
    //     $(window.frames["bottom"].document).find("body").addClass($.session.get('darkGreen'));
    // });

};

